#ifndef __PKG_H__
#define __PKG_H__

#include <string.h>

#define	INNER_CONNECT		1
#define	OUT_CONNECT		2
#define PROCESS_TIME		3

#define LEN_PKG_HEAD 					10
#define	MAX_GW_COUNT					10
#define TYPE_GW							1
#define	COMMAND_ROOM_REGISTER			1

#define TYPE_LOBBY						10
#define	COMMAND_LOBBY_JOIN_ROOM		10
#define	COMMAND_LOBBY_LEFT_ROOM		11
#define	COMMAND_LOBBY_GET_COIN		21
#define	COMMAND_LOBBY_LEFT_ROOM_IN	22
#define	COMMAND_LOBBY_GAME_SETTLE	23

#define	COMMAND_GAME_SHOWCHAT			900

#define COMMAND_DDZ_BEGIN				1
#define COMMAND_DDZ_USER_JOIN			2
#define	COMMAND_DDZ_GAME_BEGIN		3
#define	COMMAND_DDZ_GAME_JIAODIZHU	4
#define	COMMAND_DDZ_GAME_CHANGE_DESK	5
#define	COMMAND_DDZ_GAME_END			6
#define	COMMAND_DDZ_GAME_POKE			7
#define	COMMAND_DDZ_GAME_CONTINUE	8
#define	COMMAND_DDZ_GAME_OFFLINE		9
#define	COMMAND_DDZ_GAME_AUTO			10
#define	COMMAND_DDZ_GAME_CHAT			11
#define	COMMAND_DDZ_USER_CHAT			33
#define	COMMAND_DDZ_SHOW_POKER		25



#pragma pack(1)

typedef struct _pkg_head
{
	unsigned short 		length;
	unsigned short		type;
	unsigned short		command;
	unsigned int		uid;
	void packet(char *pOutput)
	{
		memcpy(pOutput, &length, 2);
		memcpy(pOutput+2, &type, 2);
		memcpy(pOutput+4, &command, 2);
		memcpy(pOutput+6, &uid, 4);
	}
	void unpacket(char *pInput)
	{
		memcpy(&length, pInput, 2);
		memcpy(&type, pInput+2, 2);
		memcpy(&command, pInput+4, 2);
		memcpy(&uid, pInput+6, 4);
	}
}pkg_head;

#pragma pack()

#endif

